.class public Lrexsee/core/transportation/RexseeAjax;
.super Ljava/lang/Object;
.source "RexseeAjax.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;
    }
.end annotation


# static fields
.field public static final AJAX_PROGRESS_CONNECTING:I = -0x1

.field public static final AJAX_PROGRESS_DONE:I = 0x1

.field public static final AJAX_PROGRESS_EXCEPTION:I = -0x3

.field public static final AJAX_PROGRESS_ONGOING:I = 0x0

.field public static final AJAX_PROGRESS_TIMEOUT:I = -0x2

.field public static final EVENT_ONAJAXPROGRESSCHANGED:Ljava/lang/String; = "onAjaxProgressChanged"

.field public static final EVENT_ONAJAXRETURNED:Ljava/lang/String; = "onAjaxReturned"

.field public static final EVENT_ONAJAXTIMEOUT:Ljava/lang/String; = "onAjaxTimeout"

.field public static final INTERFACE_NAME:Ljava/lang/String; = "Ajax"


# instance fields
.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private syncAjaxRtn:Ljava/lang/String;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 2
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 50
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 48
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->syncAjaxRtn:Ljava/lang/String;

    .line 52
    iput-object p1, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    .line 53
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onAjaxProgressChanged"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 54
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onAjaxReturned"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 55
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onAjaxTimeout"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 57
    return-void
.end method

.method static synthetic access$0(Lrexsee/core/transportation/RexseeAjax;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 47
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method

.method static synthetic access$1(Lrexsee/core/transportation/RexseeAjax;Ljava/lang/String;)V
    .locals 0

    .prologue
    .line 48
    iput-object p1, p0, Lrexsee/core/transportation/RexseeAjax;->syncAjaxRtn:Ljava/lang/String;

    return-void
.end method


# virtual methods
.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 1
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 26
    new-instance v0, Lrexsee/core/transportation/RexseeAjax;

    invoke-direct {v0, p1}, Lrexsee/core/transportation/RexseeAjax;-><init>(Lrexsee/core/browser/Browser;)V

    return-object v0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 22
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "Ajax"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 1
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 30
    new-instance v0, Lrexsee/core/transportation/RexseeAjax;

    invoke-direct {v0, p1}, Lrexsee/core/transportation/RexseeAjax;-><init>(Lrexsee/core/browser/Browser;)V

    return-object v0
.end method

.method public sendMessage(Ljava/lang/String;Ljava/lang/String;)V
    .locals 6
    .param p1, "ajaxUrl"    # Ljava/lang/String;
    .param p2, "postData"    # Ljava/lang/String;

    .prologue
    .line 165
    const/4 v3, 0x0

    const-string v4, "UTF-8"

    const/4 v5, 0x0

    move-object v0, p0

    move-object v1, p1

    move-object v2, p2

    invoke-virtual/range {v0 .. v5}, Lrexsee/core/transportation/RexseeAjax;->submit(Ljava/lang/String;Ljava/lang/String;Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;Ljava/lang/String;Z)V

    .line 166
    return-void
.end method

.method public submit(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 1
    .param p1, "ajaxUrl"    # Ljava/lang/String;
    .param p2, "postData"    # Ljava/lang/String;
    .param p3, "encode"    # Ljava/lang/String;

    .prologue
    .line 168
    const/4 v0, 0x1

    invoke-virtual {p0, p1, p2, p3, v0}, Lrexsee/core/transportation/RexseeAjax;->submit(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V

    .line 169
    return-void
.end method

.method public submit(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V
    .locals 6
    .param p1, "ajaxUrl"    # Ljava/lang/String;
    .param p2, "postData"    # Ljava/lang/String;
    .param p3, "encode"    # Ljava/lang/String;
    .param p4, "cancelable"    # Z

    .prologue
    .line 171
    new-instance v3, Lrexsee/core/transportation/RexseeAjax$2;

    invoke-direct {v3, p0, p4}, Lrexsee/core/transportation/RexseeAjax$2;-><init>(Lrexsee/core/transportation/RexseeAjax;Z)V

    .line 195
    const/4 v5, 0x1

    move-object v0, p0

    move-object v1, p1

    move-object v2, p2

    move-object v4, p3

    .line 171
    invoke-virtual/range {v0 .. v5}, Lrexsee/core/transportation/RexseeAjax;->submit(Ljava/lang/String;Ljava/lang/String;Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;Ljava/lang/String;Z)V

    .line 196
    return-void
.end method

.method public submit(Ljava/lang/String;Ljava/lang/String;Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;Ljava/lang/String;Z)V
    .locals 11
    .param p1, "url"    # Ljava/lang/String;
    .param p2, "postData"    # Ljava/lang/String;
    .param p3, "progressListener"    # Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;
    .param p4, "encode"    # Ljava/lang/String;
    .param p5, "callbackJs"    # Z

    .prologue
    .line 60
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->urlListeners:Lrexsee/core/browser/RexseeUrl;

    invoke-virtual {v0, p1}, Lrexsee/core/browser/RexseeUrl;->getAbsoluteUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 61
    .local v1, "ajaxUrl":Ljava/lang/String;
    invoke-static {v1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v10

    .line 62
    .local v10, "uri":Landroid/net/Uri;
    if-nez v10, :cond_1

    .line 63
    if-eqz p3, :cond_0

    const/4 v2, -0x3

    const/4 v3, 0x0

    const/4 v4, 0x0

    const-string v5, "Invalid url."

    const/4 v6, 0x0

    move-object v0, p3

    invoke-virtual/range {v0 .. v6}, Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;->run(Ljava/lang/String;IIILjava/lang/String;Ljava/lang/Runnable;)V

    .line 64
    :cond_0
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/core/transportation/RexseeAjax;->getInterfaceName()Ljava/lang/String;

    move-result-object v1

    .end local v1    # "ajaxUrl":Ljava/lang/String;
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {p1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, ":Invalid url."

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 161
    :goto_0
    return-void

    .line 67
    .restart local v1    # "ajaxUrl":Ljava/lang/String;
    :cond_1
    invoke-virtual {v10}, Landroid/net/Uri;->getScheme()Ljava/lang/String;

    move-result-object v9

    .line 68
    .local v9, "scheme":Ljava/lang/String;
    if-eqz v9, :cond_2

    const-string v0, "http"

    invoke-virtual {v9, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_4

    const-string v0, "https"

    invoke-virtual {v9, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_4

    .line 69
    :cond_2
    if-eqz p3, :cond_3

    const/4 v2, -0x3

    const/4 v3, 0x0

    const/4 v4, 0x0

    const-string v5, "Invalid url."

    const/4 v6, 0x0

    move-object v0, p3

    invoke-virtual/range {v0 .. v6}, Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;->run(Ljava/lang/String;IIILjava/lang/String;Ljava/lang/Runnable;)V

    .line 70
    :cond_3
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/core/transportation/RexseeAjax;->getInterfaceName()Ljava/lang/String;

    move-result-object v1

    .end local v1    # "ajaxUrl":Ljava/lang/String;
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {p1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, ":Invalid url."

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 73
    .restart local v1    # "ajaxUrl":Ljava/lang/String;
    :cond_4
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->domainWhiteList:Lrexsee/core/browser/clazz/DomainWhiteList;

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/DomainWhiteList;->isValidUrl(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_6

    .line 74
    if-eqz p3, :cond_5

    const/4 v2, -0x3

    const/4 v3, 0x0

    const/4 v4, 0x0

    const-string v5, "Url not allowed."

    const/4 v6, 0x0

    move-object v0, p3

    invoke-virtual/range {v0 .. v6}, Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;->run(Ljava/lang/String;IIILjava/lang/String;Ljava/lang/Runnable;)V

    .line 75
    :cond_5
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/core/transportation/RexseeAjax;->getInterfaceName()Ljava/lang/String;

    move-result-object v1

    .end local v1    # "ajaxUrl":Ljava/lang/String;
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {p1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, ":Url not allowed."

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 78
    .restart local v1    # "ajaxUrl":Ljava/lang/String;
    :cond_6
    new-instance v2, Lrexsee/core/transportation/RexseeAjax$1;

    move-object v3, p0

    move-object v4, p2

    move-object v5, p4

    move-object v6, p3

    move-object v7, v1

    move/from16 v8, p5

    invoke-direct/range {v2 .. v8}, Lrexsee/core/transportation/RexseeAjax$1;-><init>(Lrexsee/core/transportation/RexseeAjax;Ljava/lang/String;Ljava/lang/String;Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;Ljava/lang/String;Z)V

    .line 160
    invoke-virtual {v2}, Lrexsee/core/transportation/RexseeAjax$1;->start()V

    goto/16 :goto_0
.end method

.method public submitWithCallback(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 6
    .param p1, "ajaxUrl"    # Ljava/lang/String;
    .param p2, "postData"    # Ljava/lang/String;
    .param p3, "encode"    # Ljava/lang/String;

    .prologue
    .line 198
    new-instance v3, Lrexsee/core/transportation/RexseeAjax$3;

    invoke-direct {v3, p0}, Lrexsee/core/transportation/RexseeAjax$3;-><init>(Lrexsee/core/transportation/RexseeAjax;)V

    .line 203
    const/4 v5, 0x1

    move-object v0, p0

    move-object v1, p1

    move-object v2, p2

    move-object v4, p3

    .line 198
    invoke-virtual/range {v0 .. v5}, Lrexsee/core/transportation/RexseeAjax;->submit(Ljava/lang/String;Ljava/lang/String;Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;Ljava/lang/String;Z)V

    .line 204
    return-void
.end method

.method public syncSubmit(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .locals 6
    .param p1, "url"    # Ljava/lang/String;
    .param p2, "postData"    # Ljava/lang/String;
    .param p3, "encode"    # Ljava/lang/String;

    .prologue
    const/4 v4, 0x1

    .line 206
    move-object v0, p0

    move-object v1, p1

    move-object v2, p2

    move-object v3, p3

    move v5, v4

    invoke-virtual/range {v0 .. v5}, Lrexsee/core/transportation/RexseeAjax;->syncSubmit(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public syncSubmit(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;
    .locals 6
    .param p1, "url"    # Ljava/lang/String;
    .param p2, "postData"    # Ljava/lang/String;
    .param p3, "encode"    # Ljava/lang/String;
    .param p4, "showProgress"    # Z
    .param p5, "cancelable"    # Z

    .prologue
    .line 209
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->syncAjaxRtn:Ljava/lang/String;

    .line 210
    new-instance v3, Lrexsee/core/transportation/RexseeAjax$4;

    invoke-direct {v3, p0, p5, p4}, Lrexsee/core/transportation/RexseeAjax$4;-><init>(Lrexsee/core/transportation/RexseeAjax;ZZ)V

    .line 234
    const/4 v5, 0x0

    move-object v0, p0

    move-object v1, p1

    move-object v2, p2

    move-object v4, p3

    .line 210
    invoke-virtual/range {v0 .. v5}, Lrexsee/core/transportation/RexseeAjax;->submit(Ljava/lang/String;Ljava/lang/String;Lrexsee/core/transportation/RexseeAjax$AjaxProgressListener;Ljava/lang/String;Z)V

    .line 235
    :goto_0
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->syncAjaxRtn:Ljava/lang/String;

    if-eqz v0, :cond_1

    .line 241
    if-eqz p4, :cond_0

    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->progressDialog:Lrexsee/core/progress/RexseeProgressDialog;

    invoke-virtual {v0}, Lrexsee/core/progress/RexseeProgressDialog;->hide()V

    .line 242
    :cond_0
    iget-object v0, p0, Lrexsee/core/transportation/RexseeAjax;->syncAjaxRtn:Ljava/lang/String;

    return-object v0

    .line 237
    :cond_1
    const-wide/16 v0, 0x64

    :try_start_0
    invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 238
    :catch_0
    move-exception v0

    goto :goto_0
.end method
